package com.group.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.group.dao.TbBillLogMapper;
import com.group.pojo.TbBillLog;
import com.group.pojo.TbBillLogExample;
import com.group.pojo.TbBillLogExample.Criteria;
import com.group.service.BillLogService;
import com.group.service.CommonService;

@Service
public class BillLogServiceImpl implements BillLogService{
	
	@Autowired
	private TbBillLogMapper billLogMapper;
	
	@Autowired
	private CommonService commonService;

	
	private void setCondition(Criteria criteria, TbBillLog log) {
		String id = log.getId();
		if (id != null && !"".equals(id)) {
			criteria.andIdEqualTo(id);
		}
		
		String billId = log.getBillId();
		if (billId != null && !"".equals(billId)) {
			criteria.andBillIdEqualTo(billId);
		}
		
		String operateUserId = log.getOperateUserId();
		if (operateUserId != null && !"".equals(operateUserId)) {
			criteria.andOperateUserIdEqualTo(operateUserId);
		}
		
		String operateUserType = log.getOperateUserType();
		if (operateUserType != null && !"".equals(operateUserType)) {
			criteria.andOperateUserTypeEqualTo(operateUserType);
		}
	}
	@Override
	public List<TbBillLog> query(TbBillLog log) {
		TbBillLogExample example = new TbBillLogExample();
		
		setCondition(example.createCriteria(), log);
		
		List<TbBillLog> list = billLogMapper.selectByExample(example);
		return list;
		
	}

}
